<?php
require_once '../../include/common.inc.php';
checklogin();
isset($_GET['keyword'])?$keyword=stripslashes($_GET['keyword']):$keyword='';
require_once __DIR__ . '/../../FilterRequest.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>等级管理首页</title>
    <link href="../css/admin_style.css" type="text/css" rel="stylesheet"/>
    <script src="../scripts/function.js"></script>
</head>

<body>
<DIV id=popImageLayer align=center  name="popImageLayer"  ></DIV>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
    <tr class="topbg">
        <td colspan="2">安全管理首页</td>
    </tr>
    <tr class="tdbg">
        <td width="70" height="26" align="right"><strong>管理导航：</strong></td>
        <td>
            <a href="default.php">管理首页</a>&nbsp;|&nbsp;
            <a href="whiteDefault.php">白名单</a>
            <a href="blackDefault.php">黑名单</a>
        </td>
    </tr>
</table>
<br />
<!--<form id="sform" name="sform" method="get" action="default.php">-->
<!--    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">-->
<!--        <tr class="tdbg3">-->
<!--            <td width="70" align="right"><strong>等级检索：</strong></td>-->
<!--            <td>-->
<!--                <table border="0" cellspacing="0" cellpadding="0">-->
<!--                    <tr>-->
<!--                        <td></td>-->
<!--                        <td><input name="keyword" type="text" id="keyword" size="15" maxlength="50"  value="--><?php //echo $keyword?><!--" />&nbsp;</td>-->
<!--                        <td><input type="submit" name="button" id="button" value="检索" class="btn "/></td>-->
<!--                    </tr>-->
<!--                </table>-->
<!--            </td>-->
<!--        </tr>-->
<!--    </table>-->
<!--</form>-->
<br />
<form name="form1" action="make.php" method="post" >
    <input name="ac" type="hidden" value="px"/>
    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
        <tr class="title">
            <td width="40" align="center">ip</td>
            <td width="60" align="center">第一次访问时间</td>
            <td width="60" align="center">最后访问时间</td>
            <td width="40" align="center">访问次数</td>
            <td width="200" align="center" style=" font-weight:normal;">修改</td>
        </tr>
        <?php
        $sq='';
        $st='';
        //如果有关键字
        if ($keyword!=''){
            $sq.=' and a.title like "%'.$keyword.'%"';
        }
        //开始读等级
        $counter = FilterRequest::getInstance()->getRecordIpCount();
        $sql='select a.* from `'.$tablepre.'remind_set_co` a where 1=1 '.$sq.' order by a.`px` desc';
        $p=new page();
        $p->setpage($counter,25);
        $result = FilterRequest::getInstance()->getWhiteList();
        foreach ($result as $row) {

//            $zt='';
//            $zt=($row['pass']=='no')?'<span class="green">屏</span>':'';
//            $zt=($zt!='')?$zt:'<span class="black">正常</span>';
//
//            $feeText='不需要';
//            if($row['fee']=='yes')
//            {
//                $feeText='需要';
//            }
            $info = FilterRequest::getInstance()->getIpInfo($row);
            ?>
            <tr class="tdbg">
                <td align="center"><?php echo $info['ip'] ?></td>

                <td align="center"><?php echo date('Y-m-d H:i:s',$info['first_visit_time'] )?></td>
                <td align="center"><?php echo date('Y-m-d H:i:s',$info['last_visit_time'] )?></td>
                <td align="center"><?php echo $info['socres'] ?></td>
                <td align="center">
                    <?php
                    //屏蔽 |
                    /*if ($row['pass']=='yes'){
                        echo'<a href="make.php?id='.$row['id'].'&ac=ping2">屏蔽</a>';
                    }else{
                        echo'<a href="make.php?id='.$row['id'].'&ac=ping1" class="green">取消</a>';
                    }*/
                    ?>
                     | <a href="ajax.php?ip=<?php echo $info['ip']??0?>&ac=delWhite"  onClick="return confirm('确定要把该ip移除白名单吗?')">移除</a>
                </td>
            </tr>
            <?php
        }
//        $db->freeresult($result);
//        $db->close();
        ?>
    </table>
    <p class="p">
        <a href="javascript:CheckAll('form1');">全选</a>/<a href="javascript:CheckOthers('form1');">反选</a>&nbsp;<input name="" type="submit"  class="btn" value="排序" />&nbsp;
<!--        <input name="" type="button"  class="btn" value="批量屏蔽" onclick="act('form1','ping2');"/>&nbsp;<input name="" type="button"  class="btn" value="取消屏蔽" onclick="act('form1','ping1');"/>&nbsp;-->
    </p>
    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
        <tr class="tdbg3">
            <td align="center">
                <?php
                if ($counter){
                    $p->getpagemenu('&keyword='.urlencode($keyword).'');
                }
                ?>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
